package com.buanalintas.sandals.pos.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@Table(name = "pos_master_position")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PosMasterPosition.findAll", query = "SELECT p FROM PosMasterPosition p"),
    @NamedQuery(name = "PosMasterPosition.findBySync", query = "SELECT p FROM PosMasterPosition p WHERE p.sync = :sync"),
    @NamedQuery(name = "PosMasterPosition.findByPositionId", query = "SELECT p FROM PosMasterPosition p WHERE p.positionId = :positionId"),
    @NamedQuery(name = "PosMasterPosition.findByPositionName", query = "SELECT p FROM PosMasterPosition p WHERE p.positionName = :positionName")})
public class PosMasterPosition implements Serializable {

    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "position_id")
    private Integer positionId;
    @Column(name = "position_name")
    private String positionName;

    public PosMasterPosition() {
    }

    public PosMasterPosition(Integer positionId) {
        this.positionId = positionId;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public Integer getPositionId() {
        return positionId;
    }

    public void setPositionId(Integer positionId) {
        this.positionId = positionId;
    }

    public String getPositionName() {
        return positionName;
    }

    public void setPositionName(String positionName) {
        this.positionName = positionName;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (positionId != null ? positionId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosMasterPosition)) {
            return false;
        }
        PosMasterPosition other = (PosMasterPosition) object;
        if ((this.positionId == null && other.positionId != null) || (this.positionId != null && !this.positionId.equals(other.positionId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
//        return "com.buanalintas.sandals.pos.entities.PosMasterPosition[ positionId=" + positionId + " ]";
        return positionName;
    }
}
